<template>
  <common-search-wrap @search="search" @reset="searchReset">
    <el-form ref="formRef" :inline="true" :model="formData">
      <el-form-item label="角色名称：" prop="rname">
        <el-input style="width: 200px" v-model="formData.rname" placeholder="请输入媒体名称" clearable />
      </el-form-item>
      <el-form-item label="角色类型：" prop="type">
        <el-select v-model="formData.type" placeholder="请选择角色类型">
            <el-option value="管理" label="管理">管理角色</el-option>
            <el-option value="主体" label="主体">主体角色</el-option>
            <el-option value="投手" label="投手">投手角色</el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </common-search-wrap>
</template>

<script setup>
import commonSearchWrap from "@/components/commonSearchWrap.vue";
import { reactive } from "vue";
import useForm from '@/hooks/useForm'
const emits = defineEmits(['submit'])
/** 搜索的方法 */
const handleSearch = () => {
  console.log('handleSearch: ', formData);
  emits('submit', formData)
}
const { formRef, search, reset } = useForm(handleSearch)
const formData = reactive({
  rname: '',
  type: ''
});
const searchReset = () => {
  reset()
  handleSearch()
}
</script>